import 'package:ccshop/entites/MenuEntity.dart';
import 'package:flutter/material.dart';

class MineBottomListView extends StatelessWidget {
  List<MenuEntity> _list;

  MineBottomListView() {
    _list = List();

    MenuEntity entity = MenuEntity("images/shop_yue_icon.png", "余额:￥0.00");
    _list.add(entity);

    entity = MenuEntity("images/shop_couple_icon.png", "优惠券");
    _list.add(entity);

    entity = MenuEntity("images/shop_vip_icon.png", "申请成为经销会员");
    _list.add(entity);

    entity = MenuEntity("images/shop_gys_icon.png", "申请成为供应商");
    _list.add(entity);

    entity = MenuEntity("images/shop_help_icon.png", "常见帮助");
    _list.add(entity);

    entity = MenuEntity("images/shop_service_icon.png", "联系客服");
    _list.add(entity);

    entity = MenuEntity("images/shop_about_icon.png", "关于我们");
    _list.add(entity);

    entity = MenuEntity("images/shop_settings_icon.png", "设置");
    _list.add(entity);
  }

  @override
  Widget build(BuildContext context) {
    return ListView.separated(
      itemBuilder: (context, index) {
        // 使用InkWell添加水波纹效果无效，需要在外层添加一个Material控件
        return Material(
          borderRadius: BorderRadius.circular(10),
          color: Colors.white,
          child: InkWell(
            onTap: (){},
            highlightColor: Color(0xFFEEEEEE),// 长按时背景的颜色
            splashColor: Color(0xFFEEEEEE), // 设置水波纹颜色
            child: Container(
              height: 60,
              padding: EdgeInsets.only(left: 20, right: 10),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Row(
                    children: [
                      Image.asset(
                        _list[index].menuSrc,
                        width: 24,
                        height: 24,
                      ),
                      Padding(padding: EdgeInsets.only(left: 10),),
                      Text(_list[index].menuName)
                    ],
                  ),
                  Row(
                    children: [
                      index == 0 ? Text("查看") : Text(""),
                      Icon(Icons.keyboard_arrow_right),
                    ],
                  )
                ],
              ),
            ),
          ),
        );
      },
      separatorBuilder: (context, index) {
        return Divider(
          color: Color(0xFFEEEEEE),
          height: 1,
        );
      },
      itemCount: _list.length,
      shrinkWrap: true,
      scrollDirection: Axis.vertical,
      physics: NeverScrollableScrollPhysics(),
    );
  }
}
